DEW.PerfilController = function() {
};

$.extend(DEW.PerfilController.prototype, {
    render: function() {
        DEW.ViewManager.removeAll();
        alert("Hola");
        this.displayLayout();
        this.displayHeader();
        this.displayBody();
        this.displayFooter();
    },
    displayLayout: function() {
        var baseLayout = new DEW.BaseLayout();
        baseLayout.render();
        $(baseLayout.el).appendTo("#content");
        DEW.ViewManager.addView(baseLayout);
    },
    displayHeader: function() {
        var header = new DEW.Header({
            logo: {
                src: 'images/logo.jpg',
                alt: 'Logo'
            },
            enlaces: [{
                    id: 0,
                    text: 'Home',
                    show: true,
                    textonly: false,
                    url: 'home',
                    handler: function() {
                    }
                }, {
                    id: 1,
                    text: 'Que es?',
                    url: "Quees",
                    show: true,
                    textonly: false,
                    handler: function() {
                    }
                }, {
                    id: 2,
                    text: 'Apoya un Proyecto',
                    show: true,
                    url: "ApoyaProject",
                    textonly: false,
                    handler: function() {
                    }
                }, {
                    id: 3,
                    text: 'Registrate',
                    show: true,
                    url: "RegistroUser",
                    textonly: false,
                    handler: function() {
                    }
                }]
        });
        header.render();
        $(header.el).appendTo("#header");
    },
    displayBody: function() {

        //Cargando categorias
        var menuPanel = new DEW.MenuPanel();
        menuPanel.fetch({reset: true});

        var sidebar = new DEW.Sidebar({
            model: menuPanel
        });

        sidebar.on("changeCategory", function(categoryId) {
            listView.categoryId = categoryId;
            listView.render();
        });

        $(sidebar.el).appendTo("#sidebar");
        DEW.ViewManager.addView(sidebar);

        //Cargando lista de datos
  //      var menuPanel = DEW.StoreManager.get('menuPanel');
  //      if (menuPanel === null) {
  //          menuPanel = new DEW.MenuPanel();
  //          menuPanel.fetch({reset: true});
  //      }

        var perfil = new DEW.PerfilUsuario();
        perfil.render();
        $(perfil.el).appendTo("#page-content");
        DEW.ViewManager.addView(perfil);




    },
    displayFooter: function() {
        var footer = new DEW.Footer();
        footer.render();
        $(footer.el).appendTo("#footer");
        DEW.ViewManager.addView(footer);
    }

});